package com.lwj.liwanjia.adapter;

import android.content.Context;
import android.graphics.Paint;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.lwj.liwanjia.R;
import com.lwj.liwanjia.bean.BaobeiBean;
import com.lwj.liwanjia.bean.LitepalBean;
import com.superrecycleview.superlibrary.adapter.BaseViewHolder;
import com.superrecycleview.superlibrary.adapter.SuperBaseAdapter;

import java.util.List;

/**
 * 模糊搜索结果
 */

public class SearchListAdapter extends SuperBaseAdapter<BaobeiBean.DataBean> {
    private Context context;

    public SearchListAdapter(Context context, List<BaobeiBean.DataBean> data) {
        super(context, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder holder, BaobeiBean.DataBean item, int position) {
        Glide.with(context).load(item.getImgUrl()).error(R.mipmap.tupian).into((ImageView) holder.getView(R.id.iv_search));
        holder.setText(R.id.tv_search_name, item.getCommodityName())
                .setText(R.id.tv_search_jianjie, item.getCommodityInfo())
                .setText(R.id.tv_search_price, "￥"+item.getNowPrice())
                .setText(R.id.tv_search_price1, "￥"+item.getCommodityPrice());
        TextView price1 = holder.getView(R.id.tv_search_price1);
        price1.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
    }

    @Override
    protected int getItemViewLayoutId(int position, BaobeiBean.DataBean item) {
        return R.layout.search_detail_item;//宝贝
    }

}
